package kore.start

import io.ktor.application.*
import io.ktor.request.*
import io.ktor.response.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import java.io.File

fun main() {
    embeddedServer(Netty, port = 8000) {
        routing {
            get("/") {
                call.respondText("Hello, world!")
            }
            get("/test") {
                call.respondText("Hello, test!")
            }
            get("/file") {
                call.respondFile(File("app1.apk")) {
                    println(this.contentLength)
                    println(this.contentType)
                }
            }
            get("/zip") {
                call.respondFile(File("test.zip"))
            }
            post("/post") {
                println(call.receiveText())
                call.respondText("ok")
            }
        }
    }.start(wait = true)
}